﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddSupplierTarifas.aspx.cs" Inherits="NewTierra.Pages.Servicos.AddSupplierTarifas" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor" TagPrefix="cc1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <link rel="shortcut icon" href="../../images/Icones/favicon.ico" type="image/x-icon" />

    <link href="../../Styles/jquery_notification.css" rel="stylesheet" />

    <link href="../../Styles/jquery-ui.css" rel="stylesheet" />    
    <script type="text/javascript" src="../../Scripts/jquery-1.11.0.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery-ui-1.10.0.js"></script>

    <script type="text/javascript" src="../../Scripts/jquery_notification_v.1.js"></script>

    <link href="../../Styles/EstiloGeral.css" rel="stylesheet" />

    <style type="text/css">
        #AddSupplierTarifas
        {
            height: 590px;
            width: 800px;
            padding: 5px;
        }

        .GridMServico
        {
            width: 771px;
            overflow-x: auto;
            overflow-y: auto;
            height: 460px;
        }

        .DropSuppliers
        {
            width: 397px;
            height: 43px;
        }

        .middle
        {
            height: 567px;
            padding: 5px;
            display: inline;
            float: left;
            position: relative;
            border: 1px solid #E6E6E6;
            background: #FAFAFA;
            color: #666;
            margin-top: 0px;
            width: 779px;
            top: 0px;
            left: 0px;
        }
    </style>

</head>
<body>

    <form id="form1" runat="server">

        <script type="text/javascript">

            function ShowIcon() {
                var e = document.getElementById("processing");
                e.style.visibility = (e.style.visibility == 'visible') ? 'hidden' : 'visible';
            }

            function ShowIcon2() {
                var e = document.getElementById("processing2");
                e.style.visibility = (e.style.visibility == 'visible') ? 'hidden' : 'visible';
            }

            function CallServerServico() {
                document.getElementById('<%= btnFiltroNomeSupplier.ClientID %>').click();
            }

        </script>

        <asp:ScriptManager ID="ScriptManagerServico" runat="server">
        </asp:ScriptManager>

        <script type="text/javascript">
            function showAutoCloseMessage(MsgsExc) {
                showNotification({
                    message: MsgsExc,
                    autoClose: true,
                    type: "success",
                    duration: 2
                });
            }
        </script>

        <div id="AddSupplierTarifas">

            <asp:UpdatePanel ID="UpdatePanelAddSupplierTarifa" runat="server">
                <ContentTemplate>

                    <div class="middle radius">

                        <div class="DropSuppliers">

                            <asp:Label ID="lblSupplierMServicoTXT" runat="server" Text="Supplier:"></asp:Label><br />
                            <asp:TextBox ID="txtSupplier" runat="server" MaxLength="50" placeholder="Informe o nome do supplier." Width="340px"></asp:TextBox>

                            <asp:AutoCompleteExtender
                                ID="AutoCompleteExtenderSupplier"
                                runat="server" CompletionInterval="100"
                                DelimiterCharacters="" EnableCaching="False"
                                Enabled="True" MinimumPrefixLength="1" OnClientItemSelected="CallServerServico"
                                OnClientPopulated="ShowIcon2" OnClientPopulating="ShowIcon2"
                                ServiceMethod="SearchSuppliers" ServicePath="" TargetControlID="txtSupplier">
                            </asp:AutoCompleteExtender>

                            <img id="processing2" alt="load" src="../../images/ajax-loader.gif" style="visibility: hidden" />
                            <asp:Button ID="btnFiltroNomeSupplier" runat="server" OnClick="btnFiltroNomeSupplier_Click" Style="display: none"></asp:Button>


                        </div>

                        <table>
                            <tr>
                                <td>
                                    <asp:Button ID="btnFechar" runat="server" Text="Fechar" CssClass="btnGeralAzul" OnClientClick="self.close();" />
                                </td>
                                <td>
                                    <asp:RadioButtonList ID="rdoBasesIndexSubServico" runat="server" RepeatDirection="Horizontal" BorderStyle="None" OnSelectedIndexChanged="rdoBasesIndexSubServico_SelectedIndexChanged" AutoPostBack="true">
                                        <asp:ListItem Value="1" Selected="True" Text="Base Principal" />
                                        <asp:ListItem Value="2" Text="Base 2" />
                                        <asp:ListItem Value="3" Text="Base 3" />
                                    </asp:RadioButtonList>
                                </td>
                            </tr>
                        </table>

                        <div class="GridMServico">

                            <asp:Label ID="lblAddSupplierTarifas" runat="server" CssClass="MsgErro" Text="" />

                            <br />

                            <asp:GridView ID="GridMServicos" runat="server"
                                AutoGenerateColumns="False" GridLines="None" CssClass="mGrid" EmptyDataText="Não existe Serviços para esse Supplier."
                                Height="57px"
                                Width="373px">
                                <AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>
                                <Columns>

                                    <asp:BoundField DataField="IdMServico" HeaderText="ID" ReadOnly="True"
                                        SortExpression="IdMServico" InsertVisible="False">
                                        <FooterStyle CssClass="invisible" />
                                        <HeaderStyle CssClass="invisible" />
                                        <ItemStyle CssClass="invisible" />
                                    </asp:BoundField>

                                    <asp:BoundField DataField="MServico_DataFrom" HeaderText="Data To" DataFormatString="{0:dd/MM/yyyy}" />

                                    <asp:BoundField DataField="MServico_DataTo" HeaderText="Data To" DataFormatString="{0:dd/MM/yyyy}" />

                                    <asp:BoundField DataField="ItemSubServico" HeaderText="Item SubServiço">

                                        <HeaderStyle Wrap="False" />
                                        <ItemStyle Wrap="False" HorizontalAlign="Center" />
                                    </asp:BoundField>

                                    <asp:BoundField DataField="SubItem" HeaderText="Sub Item">

                                        <HeaderStyle Wrap="False" />
                                        <ItemStyle Wrap="False" HorizontalAlign="Center" />
                                    </asp:BoundField>

                                    <asp:BoundField DataField="Moeda_sigla" HeaderText="Moeda">
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:BoundField>

                                    <asp:BoundField DataField="MServico_Obs" HeaderText="Obs">
                                        <ItemStyle Wrap="False" />
                                    </asp:BoundField>

                                    <asp:BoundField DataField="Base_index" HeaderText="Base">
                                        <HeaderStyle Wrap="False" />
                                        <ItemStyle Wrap="False" HorizontalAlign="Center" />
                                    </asp:BoundField>

                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <asp:ImageButton ID="EditarMServico" ToolTip="Adicionar Sub Serviço"
                                                runat="server" ImageUrl="~/images/plus-small.png"
                                                CommandArgument='<%# Eval("IdMServico") %>'
                                                OnCommand="EditarMServico" />
                                        </ItemTemplate>
                                        <HeaderStyle Wrap="False" />
                                        <ItemStyle Wrap="False" />
                                    </asp:TemplateField>


                                </Columns>

                                <PagerStyle CssClass="pgr"></PagerStyle>

                            </asp:GridView>

                            <%--<asp:Button ID="btnClose" runat="Server"
                        Text="Close Window" OnClientClick="RefreshParent();" />--%>

                            <script type="text/javascript">
                                function RefreshParent() {
                                    window.opener.__doPostBack('GridRefreshPanel.ClientID', '');
                                    //window.opener.__doPostBack('islemlerGridView.ClientID', ''); //this is also working without GridRefreshPanel 
                                }
                            </script>

                        </div>

                    </div>


                </ContentTemplate>
            </asp:UpdatePanel>

            <!-- Área de Pre-Carregamento -->
            <div id="UpdateProgress"
                style="position: absolute; z-index: 1; left: 50%; top: 50%;">
                <asp:UpdateProgress ID="preLoading" runat="server"
                    AssociatedUpdatePanelID="UpdatePanelAddSupplierTarifa">
                    <ProgressTemplate>

                        <asp:Image ID="imgLoading" runat="server"
                            ImageUrl="~/Images/ajax-loaderG.gif" />

                    </ProgressTemplate>
                </asp:UpdateProgress>
            </div>

        </div>

    </form>

</body>
</html>
